

import java.util.ArrayList;

import logic.MySQLconnection;
import Entities.RequestEntity;
import fit.ActionFixture;
import gui.AcademicFrame;
import gui.ServerGui;

public class ReviewAndDecision  extends ActionFixture
{
	ServerGui server;
	AcademicFrame client;
	String myCode;
	String tableID="Request";
	String columnID="Status";
	String ridColumnName="Rid";
	String reqID;
	String value;
	public void setupfixture()
	{
		server = new ServerGui();
		server.fakeServer(5555, "mysql://localhost/test", "root", "Braude");
		server.myLog.setVisible(false);
		client = new AcademicFrame("Localhost",5555);
		
	}
	public void setCode (String code1)
	{
		myCode = code1;
	}
	public void setRequestID (String requestID)
	{
		reqID = requestID;
	}
	
	public void setRidColumnName(String colN)
	{
		ridColumnName=colN;
	}
	public void setValue (String val)
	{
		value = val;
	}
	  
	public boolean review()
	{
		ArrayList<Object> answer = new ArrayList<Object>();
		ArrayList<Object> question = new ArrayList<Object>();
		if(myCode.equals("approve"))
		question.add("approveRequest");
		else question.add("denyRequest");
		question.add(reqID);
		client.myclient.sendMessageToServer(question);
		while (client.answer==null);
		answer = client.answer;
		client.answer=null;
		if(answer.get(1).equals("Valid"))
			return true;
		else
			return false;
	}
	
}
